<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head>

</h:head>
<h:body>
	<h:form id="frmCond">
		<br />
		<h3 style="margin-top: 0">CADASTRO DE CONDIÇÃO DE PAGAMENTO</h3>
		<div align="left">

			<p:commandButton value="Novo" actionListener="#{condPgtoBens.novo}"
				disabled="#{condPgtoBens.btNovo}" update="frmCond" />

			<p:commandButton value="Salvar"
				actionListener="#{condPgtoBens.salvar}" update="frmCond"
				disabled="#{condPgtoBens.btSalvar}" />

			<p:commandButton value="Editar"
				actionListener="#{condPgtoBens.editar}"
				disabled="#{condPgtoBens.btEditar}" />

			<p:commandButton value="Consulta" type="button"
				onclick="PF('consulta').show();" />

			<p:commandButton value="Cancelar"
				actionListener="#{condPgtoBens.novo}"
				disabled="#{condPgtoBens.btExcluir}" update="frmCond" />

			<p:commandButton value="Excluir"
				actionListener="#{condPgtoBens.excluir}"
				disabled="#{condPgtoBens.btExcluir}" />

			<p:messages id="messages" showDetail="true" autoUpdate="true"
				closable="true" />

			<p:dialog header="Consulta" widgetVar="consulta" modal="true"
				height="350" width="600">

				<h:panelGrid columns="1">

					<p:commandButton value="Listar" update="listaCondPgto"
						actionListener="#{condPgtoBens.pesquisar}" />
				</h:panelGrid>


				<p:dataTable id="listaCondPgto" paginator="true" rows="6"
					value="#{condPgtoBens.lista}" var="lista">

					<p:column headerText="Codigo">
						<h:outputText value="#{lista.idCondPgto}" />
					</p:column>

					<p:column headerText="Descrição">
						<h:outputText value="#{lista.descricao}" />
					</p:column>

					<p:column headerText="Parcelas">
						<h:outputText value="#{lista.parcela}" />
					</p:column>

					<p:column headerText="Intervalo Dias">
						<h:outputText value="#{lista.intervaloDias}" />
					</p:column>

					<p:column headerText="Inativa">
						<h:outputText value="#{lista.inativar}" />
					</p:column>

					<p:column headerText="Selecionar">
						<p:commandLink id="link" value="Selecionar" ajax="dialog,frmCond"
							action="#{condPgtoBens.selecionar}" update="dados">
							<f:setPropertyActionListener value="#{lista.idCondPgto}"
								target="#{condPgtoBens.id}" />
						</p:commandLink>
					</p:column>

				</p:dataTable>

			</p:dialog>

			<p:tabView style="border: 0px">

				<p:tab id="dados" title="Cadastro">

					<h:panelGrid columns="2" columnClasses="label, value">
						
					Inativa:
						<p:selectBooleanCheckbox id="inativar"
							value="#{condPgtoBens.condPgto.inativar}" />
					</h:panelGrid>
					<h:panelGrid columns="2" columnClasses="label, value">
					
					Codigo:
					<p:inputText id="idCondPgto" disabled="true"
							value="#{condPgtoBens.condPgto.idCondPgto}" />
					
					Descrição:
					<p:inputText id="CondDesc"
							value="#{condPgtoBens.condPgto.descricao}" size="30" />
							
					Parcela:
					<p:inputText id="parcela" value="#{condPgtoBens.condPgto.parcela}"
							size="10" />
							
					Intervalo Dias
					<p:inputText id="intervalo"
							value="#{condPgtoBens.condPgto.intervaloDias}" size="10" />

					</h:panelGrid>

				</p:tab>


			</p:tabView>
		</div>
	</h:form>
</h:body>
</html>